package sg.edu.nus.iss.cats.controller;

import sg.edu.nus.iss.cats.model.User;
import sg.edu.nus.iss.cats.model.Employee;

public class UserSession {

	private String sessionId = null;
	private User user = null;
	private Employee employee = null;
	private Employee[] subordinates = null;

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public User getUser() {
		return user;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setSubordinates(Employee[] subordinates) {
		this.subordinates = subordinates;
	}

	public Employee[] getSubordinates() {
		return subordinates;
	}

	public boolean isEmployee() {
		if (user == null)
			return false;
		return user.hasRole("employee");
	}

	public boolean isManager() {
		if (user == null)
			return false;
		return user.hasRole("manager");
	}

	public boolean isAdmin() {
		if (user == null)
			return false;
		return user.hasRole("admin");
	}

}
